home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / STRUC1.C < prev    next >
C/C++ Source or Header  |  1993-05-12  |  3KB  |  77 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville MI
  3. Date: 05-09-93 (17:09)             Number: 104
  4. From: JAMES WHATLEY                Refer#: NONE
  5.   To: ALL                           Recvd: NO  
  6. Subj: Structures                     Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8. Hi ya'll,
  9.  
  10. I'm back with questions about structures and passing information
  11. into.
  12.  
  13. Here's how the structure looks:
  14.  
  15. struct cattribs{
  16.       int  strength;
  17.       int  dexterity;
  18.       int  wisdom;
  19.       int  intelligence;
  20.       int  charisma;
  21.       int  constitution;
  22.       int  hitpoints;
  23.       char charname[80];
  24.       char playername[80];
  25.       char charrace[40];
  26.       char charclass[40];
  27.       char status[40];
  28.       char charalign[20];
  29.       }player;
  30.  
  31. and here's the information I'm trying to pass to it:
  32. int align(void)
  33. {
  34.   char choice;
  35.   printf("\nNow you need to choose your characters alignment.\n");
  36.   printf("Choices are:\n");
  37.   printf("LG = Lawful Good         LE = Lawful Evil\n");
  38.   printf("NG = Neutral Good        NE = Neutral Evil\n");
  39.   printf("CG = Chaotic Good        CE = Chaotic Evil\n");
  40.   printf("              TN = True Neural");
  41.   printf("\n\nEnter the two character code of your choice: ");
  42.   scanf("%s", &choice);
  43.  
  44.   if(choice == "LG" || choice == "lg" || choice == "Lg" || choice == "lG")
  45.     player.charalign = "Lawful Good";
  46.   else if(choice == "LE" || choice == "le" || choice == "Le" || choice == "lE")
  47.     player.charalign = "Lawful Evil";
  48.   else if(choice == "NG" || choice == "ng" || choice == "Ng" || choice == "nG")
  49.     player.charalign = "Neutral Good";
  50.   else if(choice == "NE" || choice == "ne" || choice == "Ne" || choice == "nE")
  51.     player.charalign = "Neutral Evil";
  52.   else if(choice == "CG" || choice == "cg" || choice == "Cg" || choice == "cG")
  53.     player.charalign = "Chaotic Good";
  54.   else if(choice == "CE" || choice == "ce" || choice == "Ce" || choice == "cE")
  55.     player.charalign = "Chaotic Evil";
  56.   else if(choice == "TN" || choice == "tn" || choice == "Tn" || choice == "tN")
  57.     player.charalign = "True Neutral";
  58.  
  59.   return(0);
  60. }
  61.  
  62. Now for the problem..How do I pass to player.charalign the string
  63. that I want in there?  I've tried using == and still no good.  I'm
  64. attempting to compile this under OS/2 2.0 using GNU's gcc compiler.
  65. Any help (preference is hints) in pointing towards the right
  66. direction would be greatly appreciated.
  67.  
  68. Jim
  69.  
  70.  
  71. ... Just cannot resist a little fun along the way.  :-)
  72. --- GEcho 1.00
  73.  * Origin: The Watering Hole BBS Tokyo +81-3-3657-9255 (6:730/18.0)
  74. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  75. SEEN-BY: 153/752 154/40 77 157/2 159/100 125 575 950 203/23 209/209 261/1023
  76. SEEN-BY: 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
  77.